package com.xiaoran.spring.controller;

import com.xiaoran.spring.domain.CommResult;
import com.xiaoran.spring.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class StroageController {
    @Autowired
    private StorageService storageService;

    @RequestMapping("/storage/decrease")
    public CommResult decrease(@RequestParam("product_id") Long product_id, @RequestParam("count") Integer count) {
        storageService.decrease(product_id,count);
        return new CommResult(200,"扣减库存成功！");
    }

}
